|
|
|
|
|
|
|
Try this by adding a single menu item that will execute the preceding line of code. Of course, you need to add a standard form to your project. After you have done this, re-test the application in the Web browser and select the menu option. |
|
|
|
|
|
|
|
|
Converting an Existing Visual Basic Application |
|
|
|
|
|
|
|
|
So far, you have seen how to create an ActiveX document from scratch. But, if you have a lot of time and effort invested in creating standard Visual Basic applications, you really want some way to capitalize on the work you have already done. Fortunately, Visual Basic provides a tool called the ActiveX Document Migration Wizard, which helps you convert forms from an existing application into UserDocument objects for an ActiveX document. |
|
|
|
|
|
|
|
|
However, because an ActiveX document doesn't support all of the properties, methods, and events that a standard form does, the Migration Wizard will not create a complete ActiveX document directly from your standard application. The following lists what the wizard does do: |
|
|
|
|
|
|
|
|
Copies the properties of the form to a new user document. |
|
|
|
|
|
|
|
|
Copies menu items from the source form to the new user document. |
|
|
|
|
|
|
|
|
Copies all controls from the source form and retains their relative positions on the form. All control properties are retained except for any OLE container controls and embedded OLE objects, which are not copied. |
|
|
|
|
|
|
|
|
Copies the code from the form event procedures to the corresponding procedures in the user document. This includes all event procedures associated with the component controls. |
|
|
|
|
|
|
|
|
Comments out code statements that are not supported by ActiveX documents, such as Load, Unload, and End. |
|
|
|
|
|
|
|
|
Although the Migrate Wizard can do a lot of the work of converting a document for you, there are some things that it cannot handle. You will have to do some coding work before you can compile and distribute your document. |
|
|
|
|
|
|
|
|
First, you need to remove unsupported events such as Load and Unload. Although the wizard will comment out the Load and Unload statements, it will not remove the event procedures code. If you use these events to initialize the properties of a form or its controls; you may want to move some of the code from the Load event to the Initialize event of the UserDocument. Also, you may want to move some of the code from the Unload event to the Terminate event of the UserDocument. |
|
|
|
|
|